package cn.yanjr.common.web;

import java.io.UnsupportedEncodingException;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;

import cn.yanjr.common.Constant;

@WebServlet(name = "GetServlet")
public class GetServlet extends HttpServletRequestWrapper{

	private HttpServletRequest request;
	
	@Override
    public String getParameter(String name) {
        if(name == null){return  null;}
        String newName = super.getParameter(name);
        if(newName != null) {
        	 try {
                 newName =  new String(newName.getBytes(Constant.ISO_8859_1_CHARSET), Constant.DEFAULT_CHARSET);
                 return newName;
             } catch (UnsupportedEncodingException e) {
                throw new RuntimeException("get方式提交的编码异常"+e);
             }
        } else {
        	return newName;
        }
       
 
    }
	
	public GetServlet(HttpServletRequest request) {
		super(request);
        this.request = request;
	}

}
